<#include "/layout/layout.ftl">
<#import "/layout/macro.ftl" as macro>
<#assign css>
<style>
</style>
</#assign>
<#assign js>
<script>


	function off(id) {
		layer.confirm('确定停用吗?', {icon: 3, title: '提示'}, function (index) {
			$.ajax({
				type: "POST",
				dataType: "json",
				url: "/sysParam/off/" + id,
				success: function (res) {
					layer.msg(res.message, {time: 2000}, function () {
						location.reload();
					});
				}
			});
		});
	}

    function on(id) {
        layer.confirm('确定启用吗?', {icon: 3, title: '提示'}, function (index) {
            $.ajax({
                type: "POST",
                dataType: "json",
                url: "/sysParam/on/" + id,
                success: function (res) {
                    layer.msg(res.message, {time: 2000}, function () {
                        location.reload();
                    });
                }
            });
        });
    }


</script>
</#assign>
<@layout title="临时加价参数设置" active="sysParam">
<!-- Content Header (Page header) -->

<!-- Main content -->
<section class="content">
	<!-- Default box -->
	<div class="box box-primary">
		<div class="box-header">
        <#--<@shiro.hasPermission name="system:sysParam:add">
			<a class="btn btn-sm btn-success" href="/sysParam/add">新增</a>
        </@shiro.hasPermission>-->
		</div>
		<div class="box-body">
			<table class="table table-striped">
				<tr>
					<th></th>
					<th>参数名称</th>
					<th>参数值</th>
					<th>是否正在生效</th>
					<th>开始时间</th>
					<th>结束时间</th>
					<th>操作</th>
				</tr>
                <#list pageInfo.list as item>
                <tr>
					<td >${item.id!}</td>
					<td >${item.note!}</td>
					<td >
						<#if item.value=="ON" >
							<span class="label label-success">开</span>
						<#elseif item.value=="OFF">
                            <span class="label label-default">关</span>
						</#if>

					</td>
                    <td >
						<#if item.value=="ON" &&  item.isRunning?? && item.isRunning == "1">
							<span class="label label-danger">生效中</span>
						</#if>
					</td>
                    <td >${item.startTime!}

					</td>
                    <td >${item.endTime!}</td>
					<td>

                    <@shiro.hasPermission name="system:sysParam:edit">
						<#if item.value== "ON" >
							<button class="btn btn-sm btn-danger" onclick="off('${item.name}')" >关闭</button>
						<#elseif item.value=="OFF">
                            <button class="btn btn-sm btn-success" onclick="on('${item.name}')">开启</button>
						</#if>


						<#if item.name== "FEE_NIGHT_SWITCH" >
							<a class="btn btn-sm btn-primary" href="/agent/edit/${item.agentId}" data-btn-type="edit">去设置</a>
						<#elseif item.name=="FEE_WEATHER_SWITCH">
                            <a class="btn btn-sm btn-primary" href="/weather/index" data-btn-type="edit">去设置</a>
						<#elseif item.name=="FEE_HOLIDAY_SWITCH">
                            <a class="btn btn-sm btn-primary" href="/holiday/index" data-btn-type="edit">去设置</a>
						</#if>

                    </@shiro.hasPermission>

					</td>
				</tr>
                </#list>
			</table>
		</div>
		<!-- /.box-body -->
		<div class="box-footer clearfix">
            <@macro.page pageInfo=pageInfo url="/sysParam/index?" />
		</div>
	</div>
	<!-- /.box -->

</section>
<!-- /.content -->
</@layout>
